//
//  FocusMoreCell.m
//  Everest
//
//  Created by Liu Chengbo on 14/12/25.
//  Copyright (c) 2014年 ThreeL. All rights reserved.
//

#import "FocusMoreCell.h"
#import "FocusMore.h"
#import "UIImageView+WebCache.h"

@interface FocusMoreCell ()
@property (nonatomic, retain) UIImageView *myImageView;
@property (nonatomic, retain) UILabel *myLabel;
@end

@implementation FocusMoreCell
- (void)dealloc
{
    [_myImageView release];
    [_myLabel release];
    [_foc release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.myImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:self.myImageView];
        
        self.myLabel = [[UILabel alloc] init];
        [self.contentView addSubview:self.myLabel];
    }
    return self;
}
- (void)setFoc:(FocusMore *)foc
{
    if (_foc != foc) {
        [_foc release];
        _foc = [foc retain];
    }
    [self.myImageView setImageWithURL:[NSURL URLWithString:self.foc.coverPathBig]];
    self.myLabel.text = self.foc.title;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    self.myImageView.frame = CGRectMake(0, 0, self.contentView.bounds.size.width, self.contentView.bounds.size.height - 10);
    
    self.myLabel.frame = CGRectMake(0, self.contentView.bounds.size.height - 10 - 35, self.contentView.bounds.size.width, 35);
    self.myLabel.backgroundColor = [UIColor colorWithRed:35 / 255.0 green:45 / 255.0 blue:55 / 255.0 alpha:0.5];
    self.myLabel.textColor = [UIColor whiteColor];
    self.myLabel.textAlignment = NSTextAlignmentCenter;
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
